/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package interfaz;

import clases.*;
import java.awt.BorderLayout;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

/**
 *
 * @author Usuario
 */
public class frmPrincipal extends javax.swing.JFrame {

    private ClsDatabase bd = new ClsDatabase();
    private ClsSeguridad seguridad = new ClsSeguridad();
    private ClsSesion sesion = new ClsSesion();
    private ClsMetodos metodos = new ClsMetodos();

    /**
     * Creates new form frmPrincipal3
     */
    public frmPrincipal() {
        setIconImage(new ImageIcon(getClass().getResource("/resource/icon/principales/Logo.png")).getImage());
        initComponents();

        //setIconImage(new ImageIcon(getClass().getResource("/resource/icon/principales/logo.png")).getImage());
        this.setExtendedState(frmPrincipal.MAXIMIZED_BOTH);//estado maximizado de la ventana
        this.setLocationRelativeTo(null);//Centramos la ventana
        ///jLabel2.setText(ClsSesion.nombre_usuario);

        mnuUser.setText("<HTML><b><u>" + ClsSesion.nombre_usuario + "</u></b></HTML>");
//        setIconImage (new ImageIcon("/resource/icon/principales/logo.png").getImage());
        //  ImageIcon icon = new ImageIcon("/resource/icon/principales/peque/cerrar.png");
        //setIconImage(getIconImage());

        //private clases.JTabbedPanePersonalized mike;
        //clases.JTabbedPanePersonalized mike = new clases.JTabbedPanePersonalized();
        //jTabbedPane2=mike;
        // jTabbedPane2=tabbedPane;
    }

    public Image getIconImage() {
        Image retValue = Toolkit.getDefaultToolkit().
                getImage(ClassLoader.getSystemResource("/resource/icon/principales/Logo.png"));

        return retValue;
    }

    public void agregar_tab(String nombre, javax.swing.JPanel panel) {
        // ImageIcon icon = new ImageIcon("/resource/icon/principales/peque/cerrar.png");

        int n = jTabbedPane2.getTabCount();
        boolean v = true;
        for (int i = 0; i < n; i++) {
            if (jTabbedPane2.getTitleAt(i).equals(nombre)) {
                jTabbedPane2.setSelectedIndex(i);
                v = false;
                return;
            }
        }
        if (v) {
            jTabbedPane2.add(nombre, panel);
            jTabbedPane2.setTabComponentAt(n, new ButtonTabComponent(jTabbedPane2));
            jTabbedPane2.setSelectedIndex(n);
        }
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPopupMenu1 = new javax.swing.JPopupMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();
        jToolBar1 = new javax.swing.JToolBar();
        btnProyectos = new javax.swing.JButton();
        btnPresupuestos = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jButton4 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jLabel4 = new javax.swing.JLabel();
        btnUsuarios1 = new javax.swing.JButton();
        btnUsuarios2 = new javax.swing.JButton();
        btnUsuarios3 = new javax.swing.JButton();
        btnUsuarios4 = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jButton5 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        btnUsuarios = new javax.swing.JButton();
        btnCerrarSesion = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jTabbedPane2 = new javax.swing.JTabbedPane();
        jLabel1 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem12 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenuItem15 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenuItem16 = new javax.swing.JMenuItem();
        jMenuItem21 = new javax.swing.JMenuItem();
        jSeparator4 = new javax.swing.JPopupMenu.Separator();
        jMenuItem17 = new javax.swing.JMenuItem();
        jMenuItem18 = new javax.swing.JMenuItem();
        jMenuItem19 = new javax.swing.JMenuItem();
        jMenuItem20 = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jMenuItem9 = new javax.swing.JMenuItem();
        jMenuItem10 = new javax.swing.JMenuItem();
        mnuUser = new javax.swing.JMenu();
        mnuitemCambiarSesion = new javax.swing.JMenuItem();
        mnuitemSalirSistema = new javax.swing.JMenuItem();

        jMenuItem1.setText("Crear proyecto");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jPopupMenu1.add(jMenuItem1);

        jMenuItem2.setText("Crear plantilla");
        jPopupMenu1.add(jMenuItem2);

        jMenu5.setText("jMenu5");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Sistema de costos de saneamiento básico");
        setMinimumSize(new java.awt.Dimension(1200, 720));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jToolBar1.setBackground(new java.awt.Color(3, 25, 48));
        jToolBar1.setFloatable(false);
        jToolBar1.setOpaque(false);

        btnProyectos.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnProyectos.setForeground(new java.awt.Color(1, 102, 184));
        btnProyectos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/proyecto_tool.png"))); // NOI18N
        btnProyectos.setText("Proys");
        btnProyectos.setFocusable(false);
        btnProyectos.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnProyectos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnProyectosActionPerformed(evt);
            }
        });
        jToolBar1.add(btnProyectos);

        btnPresupuestos.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnPresupuestos.setForeground(new java.awt.Color(1, 102, 184));
        btnPresupuestos.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/presupuesto_tool.png"))); // NOI18N
        btnPresupuestos.setText("Pptos");
        btnPresupuestos.setFocusable(false);
        btnPresupuestos.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnPresupuestos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPresupuestosActionPerformed(evt);
            }
        });
        jToolBar1.add(btnPresupuestos);

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/separador.png"))); // NOI18N
        jToolBar1.add(jLabel3);

        jButton4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jButton4.setForeground(new java.awt.Color(1, 102, 184));
        jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/gastos.png"))); // NOI18N
        jButton4.setText("GG");
        jButton4.setFocusable(false);
        jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jToolBar1.add(jButton4);

        jButton3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jButton3.setForeground(new java.awt.Color(1, 102, 184));
        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/aporte.png"))); // NOI18N
        jButton3.setText("Aportes");
        jButton3.setFocusable(false);
        jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton3);

        jButton2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jButton2.setForeground(new java.awt.Color(1, 102, 184));
        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/polinomica.png"))); // NOI18N
        jButton2.setText("Polinom");
        jButton2.setFocusable(false);
        jButton2.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jToolBar1.add(jButton2);

        jButton1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jButton1.setForeground(new java.awt.Color(1, 102, 184));
        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/cronograma.png"))); // NOI18N
        jButton1.setText("Cronog");
        jButton1.setFocusable(false);
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        jToolBar1.add(jButton1);

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/separador.png"))); // NOI18N
        jToolBar1.add(jLabel4);

        btnUsuarios1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnUsuarios1.setForeground(new java.awt.Color(1, 102, 184));
        btnUsuarios1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/partidas_tool.png"))); // NOI18N
        btnUsuarios1.setText("Partidas");
        btnUsuarios1.setFocusable(false);
        btnUsuarios1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnUsuarios1.setOpaque(false);
        btnUsuarios1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUsuarios1ActionPerformed(evt);
            }
        });
        jToolBar1.add(btnUsuarios1);

        btnUsuarios2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnUsuarios2.setForeground(new java.awt.Color(1, 102, 184));
        btnUsuarios2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/insumos_tool.png"))); // NOI18N
        btnUsuarios2.setText("Insumos");
        btnUsuarios2.setFocusable(false);
        btnUsuarios2.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnUsuarios2.setOpaque(false);
        btnUsuarios2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUsuarios2ActionPerformed(evt);
            }
        });
        jToolBar1.add(btnUsuarios2);

        btnUsuarios3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnUsuarios3.setForeground(new java.awt.Color(1, 102, 184));
        btnUsuarios3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/titulos.png"))); // NOI18N
        btnUsuarios3.setText("Títulos");
        btnUsuarios3.setFocusable(false);
        btnUsuarios3.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnUsuarios3.setOpaque(false);
        btnUsuarios3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUsuarios3ActionPerformed(evt);
            }
        });
        jToolBar1.add(btnUsuarios3);

        btnUsuarios4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnUsuarios4.setForeground(new java.awt.Color(1, 102, 184));
        btnUsuarios4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/unidades_tool.png"))); // NOI18N
        btnUsuarios4.setText("Unidades");
        btnUsuarios4.setFocusable(false);
        btnUsuarios4.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        btnUsuarios4.setOpaque(false);
        btnUsuarios4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUsuarios4ActionPerformed(evt);
            }
        });
        jToolBar1.add(btnUsuarios4);

        jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/separador.png"))); // NOI18N
        jToolBar1.add(jLabel5);

        jButton5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jButton5.setForeground(new java.awt.Color(1, 102, 184));
        jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/cano.png"))); // NOI18N
        jButton5.setText("C&P SAP");
        jButton5.setFocusable(false);
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton5);

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/separador.png"))); // NOI18N
        jToolBar1.add(jLabel2);

        btnUsuarios.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnUsuarios.setForeground(new java.awt.Color(1, 102, 184));
        btnUsuarios.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/usuario_tool.png"))); // NOI18N
        btnUsuarios.setText("Usuarios");
        btnUsuarios.setFocusable(false);
        btnUsuarios.setOpaque(false);
        btnUsuarios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUsuariosActionPerformed(evt);
            }
        });
        jToolBar1.add(btnUsuarios);

        btnCerrarSesion.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        btnCerrarSesion.setForeground(new java.awt.Color(1, 102, 184));
        btnCerrarSesion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/peque/cerrar_tool.png"))); // NOI18N
        btnCerrarSesion.setText("Finalizar");
        btnCerrarSesion.setToolTipText("Salir del sistema");
        btnCerrarSesion.setFocusable(false);
        btnCerrarSesion.setOpaque(false);
        btnCerrarSesion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCerrarSesionActionPerformed(evt);
            }
        });
        jToolBar1.add(btnCerrarSesion);
        jToolBar1.add(jPanel1);

        getContentPane().add(jToolBar1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1740, 30));

        jPanel5.setBackground(new java.awt.Color(225, 235, 247));
        jPanel5.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
        jPanel5.add(jTabbedPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1430, 650));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/fondo_principal.jpg"))); // NOI18N
        jPanel5.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1500, -1));

        getContentPane().add(jPanel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 30, 1500, 740));

        jMenu1.setText("Archivo");

        jMenuItem12.setText("Usuario");
        jMenuItem12.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem12ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem12);

        jMenuItem5.setText("Parametros");
        jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem5ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem5);

        jMenuItem3.setText("Salir");
        jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem3ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem3);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Catálogo");

        jMenuItem11.setText("Unidades");
        jMenuItem11.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem11ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem11);

        jMenuItem6.setText("Insumos");
        jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem6ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem6);

        jMenuItem7.setText("Partidas");
        jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem7ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem7);

        jMenuItem15.setText("Títulos");
        jMenuItem15.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem15ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem15);

        jMenuItem4.setText("Índice Unificado");
        jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem4ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem4);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Módulos");

        jMenuItem8.setText("Proyectos");
        jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem8ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem8);

        jMenuItem16.setText("Presupuesto");
        jMenuItem16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem16ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem16);

        jMenuItem21.setText("Partidas");
        jMenuItem21.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem21ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem21);
        jMenu3.add(jSeparator4);

        jMenuItem17.setText("Gastos Generales");
        jMenu3.add(jMenuItem17);

        jMenuItem18.setText("Aportes");
        jMenuItem18.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem18ActionPerformed(evt);
            }
        });
        jMenu3.add(jMenuItem18);

        jMenuItem19.setText("Formula polinomica");
        jMenu3.add(jMenuItem19);

        jMenuItem20.setText("Progrmación y cronograma");
        jMenu3.add(jMenuItem20);

        jMenuBar1.add(jMenu3);

        jMenu4.setText("Reportes");
        jMenu4.setEnabled(false);

        jMenuItem9.setText("Generales");
        jMenu4.add(jMenuItem9);

        jMenuItem10.setText("Personalizados");
        jMenu4.add(jMenuItem10);

        jMenuBar1.add(jMenu4);

        mnuUser.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icon/principales/usuario_menu.png"))); // NOI18N
        mnuUser.setText("<HTML><b>NombreUsuario</b></HTML>");

        mnuitemCambiarSesion.setText("Cambiar Sesion");
        mnuitemCambiarSesion.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuitemCambiarSesionActionPerformed(evt);
            }
        });
        mnuUser.add(mnuitemCambiarSesion);

        mnuitemSalirSistema.setText("Salir del Sistema");
        mnuitemSalirSistema.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuitemSalirSistemaActionPerformed(evt);
            }
        });
        mnuUser.add(mnuitemSalirSistema);

        jMenuBar1.add(mnuUser);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void btnUsuariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUsuariosActionPerformed
        new dlgUsuariosMantenimiento(this, true).setVisible(true);
    }//GEN-LAST:event_btnUsuariosActionPerformed

    private void btnCerrarSesionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCerrarSesionActionPerformed
        int res = JOptionPane.showConfirmDialog(null, "¿Desea salir del sistema?", "Salir",
                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (res == JOptionPane.YES_OPTION) {
            System.exit(0);
        }
    }//GEN-LAST:event_btnCerrarSesionActionPerformed

    private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
        System.exit(0);
    }//GEN-LAST:event_jMenuItem3ActionPerformed

    private void jMenuItem11ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem11ActionPerformed
        new dlgUnidades(this, true).setVisible(true);
    }//GEN-LAST:event_jMenuItem11ActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        int res = JOptionPane.showConfirmDialog(null, "¿Desea Salir del Sistema?", "Salir",
                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (res == JOptionPane.YES_OPTION) {
            System.exit(0);
        } else {
            setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        }
    }//GEN-LAST:event_formWindowClosing

    private void btnProyectosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnProyectosActionPerformed
        new dlgProyectos(this, true).setVisible(true);
    }//GEN-LAST:event_btnProyectosActionPerformed

    private void mnuitemCambiarSesionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuitemCambiarSesionActionPerformed
        int res = JOptionPane.showConfirmDialog(this, "¿Desea Cambiar de Sesión?", "Salir",
                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (res == JOptionPane.YES_OPTION) {
            this.dispose();
            new frmAcceso().setVisible(true);
        }
    }//GEN-LAST:event_mnuitemCambiarSesionActionPerformed

    private void mnuitemSalirSistemaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuitemSalirSistemaActionPerformed
        int res = JOptionPane.showConfirmDialog(null, "¿Desea Salir del Sistema?", "Salir",
                JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
        if (res == JOptionPane.YES_OPTION) {
            System.exit(0);
        }
    }//GEN-LAST:event_mnuitemSalirSistemaActionPerformed

    private void btnPresupuestosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPresupuestosActionPerformed
//        new dlg_presupuesto_prototipo(this, true).setVisible(true);
        new dlgProyectos(this, true).setVisible(true);
    }//GEN-LAST:event_btnPresupuestosActionPerformed

    private void jMenuItem12ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem12ActionPerformed
        new dlgUsuariosMantenimiento(this, true).setVisible(true);
        //agregar_tab("Usuario", dialog.plnFondo);
    }//GEN-LAST:event_jMenuItem12ActionPerformed

    private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem7ActionPerformed
        new dlgPartidas(this, true).setVisible(true);
    }//GEN-LAST:event_jMenuItem7ActionPerformed

    private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem6ActionPerformed
        new dlgInsumos2(this, true).setVisible(true);
//        agregar_tab("Insumos", dialog.pnlInsumos);
    }//GEN-LAST:event_jMenuItem6ActionPerformed

    private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem5ActionPerformed
        new dlgInsumoTipo(this, true).setVisible(true);
//        agregar_tab("Generalidades", dialog.body);
    }//GEN-LAST:event_jMenuItem5ActionPerformed

    private void jMenuItem15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem15ActionPerformed
        new dlgCapitulo(this, true).setVisible(true);
    }//GEN-LAST:event_jMenuItem15ActionPerformed

    private void btnUsuarios1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUsuarios1ActionPerformed
        new dlgPartidas(this, true).setVisible(true);
    }//GEN-LAST:event_btnUsuarios1ActionPerformed

    private void btnUsuarios2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUsuarios2ActionPerformed
        new dlgInsumos2(this, true).setVisible(true);
    }//GEN-LAST:event_btnUsuarios2ActionPerformed

    private void btnUsuarios3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUsuarios3ActionPerformed
        new dlgCapitulo(this, true).setVisible(true);
    }//GEN-LAST:event_btnUsuarios3ActionPerformed

    private void btnUsuarios4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnUsuarios4ActionPerformed
        new dlgUnidades(this, true).setVisible(true);
    }//GEN-LAST:event_btnUsuarios4ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        dlgProyectosSelector dialog = new dlgProyectosSelector(this, true);
        dialog.setVisible(true);
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
        dlgIndice dialog = new dlgIndice(this, true);
        dialog.setVisible(true);
    }//GEN-LAST:event_jMenuItem4ActionPerformed

    private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem8ActionPerformed
        new dlgProyectos(this, true).setVisible(true);
    }//GEN-LAST:event_jMenuItem8ActionPerformed

    private void jMenuItem16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem16ActionPerformed
        new dlgProyectos(this, true).setVisible(true);
    }//GEN-LAST:event_jMenuItem16ActionPerformed

    private void jMenuItem21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem21ActionPerformed
        new dlgPartidas(this, true).setVisible(true);
    }//GEN-LAST:event_jMenuItem21ActionPerformed

    private void jMenuItem18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem18ActionPerformed
        dlgProyectosSelector dialog = new dlgProyectosSelector(this, true);
        dialog.setVisible(true);
    }//GEN-LAST:event_jMenuItem18ActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        dlgSap dialog = new dlgSap(new javax.swing.JFrame(), true);
        dialog.setVisible(true);
    }//GEN-LAST:event_jButton5ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(frmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(frmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(frmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(frmPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new frmPrincipal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCerrarSesion;
    private javax.swing.JButton btnPresupuestos;
    private javax.swing.JButton btnProyectos;
    private javax.swing.JButton btnUsuarios;
    private javax.swing.JButton btnUsuarios1;
    private javax.swing.JButton btnUsuarios2;
    private javax.swing.JButton btnUsuarios3;
    private javax.swing.JButton btnUsuarios4;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem15;
    private javax.swing.JMenuItem jMenuItem16;
    private javax.swing.JMenuItem jMenuItem17;
    private javax.swing.JMenuItem jMenuItem18;
    private javax.swing.JMenuItem jMenuItem19;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem20;
    private javax.swing.JMenuItem jMenuItem21;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPopupMenu jPopupMenu1;
    private javax.swing.JPopupMenu.Separator jSeparator4;
    private javax.swing.JTabbedPane jTabbedPane2;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JMenu mnuUser;
    private javax.swing.JMenuItem mnuitemCambiarSesion;
    private javax.swing.JMenuItem mnuitemSalirSistema;
    // End of variables declaration//GEN-END:variables
}
